{layout name="layout" /}

<div class="Hui-article">
    <article class="cl pd-20">
        <form action="" method="post" class="form form-horizontal" id="form-admin-pwd">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>原密码：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="password" class="input-text" autocomplete="off" value="" placeholder="初始密码" id="oldpassword" name="oldpassword">
                </div>
                <div class="col-xs-4 col-sm-4">
                    <span class="oldspan c-red"></span>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>新密码：</label>
                <div class="formControls col-xs-4 col-sm-2">
                    <input type="password" class="input-text" autocomplete="off" value="" placeholder="请输入新密码" id="newpassword" name="newpassword">
                </div>
                <div class="col-xs-4 col-sm-4">
                    <span class="newspan c-red"></span>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>确认密码：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="password" class="input-text" autocomplete="off" value="" placeholder="请再次输入新密码" id="repassword" name="repassword">
                </div>
                <div class="col-xs-4 col-sm-4">
                    <span class="respan  c-red"></span>
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                    <input class="btn btn-default radius" type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;" onClick="window.history.back();">
                </div>
            </div>
        </form>
    </article>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    $("#form-admin-pwd").submit(function () {
        var oldpassword = $("#oldpassword").val();
        var newpassword = $("#newpassword").val();
        var repassword = $("#repassword").val();

        if (isNull(oldpassword)) {
            $(".oldspan").html('* 原密码不能为空');
            return false;
        }

        if (newpassword.match(/^[a-zA-Z]\w{5,17}$/)) {
            $('.newspan').html("");
        } else {
            $('.newspan').html("* 新密码必须字母开头，长度在6-18之间，只能包含字符(或下划线)、数字");
            return false;
        }

        if (newpassword != repassword) {
            $('.respan').html("* 两次密码不一致,请重新输入");
            return false;
        } else {
            $('.respan').html("");
            return true;
        }
    })
</script>
<!--请在上方写此页面业务相关的脚本-->